home *** CD-ROM | disk | FTP | other *** search
/ Gamers Delight 2 / Gamers Delight 2.iso / Aminet / game / board / AmiBoard_V1_0.lha / AmiBoard_V1.0 / PGN / Standard < prev    next >
Text File  |  1994-03-27  |  51KB  |  1,299 lines

  1. PGN: Portable Game Notation Specification and Implementation Guide
  2.  
  3. Revised: 1993.12.19
  4.  
  5. Authors: Interested readers of the Internet newsgroup rec.games.chess
  6.  
  7. Coordinator: Steven J. Edwards (send comments to sje@world.std.com)
  8.  
  9.  
  10. 1: Introduction
  11.  
  12. PGN is "Portable Game Notation", a format designed for the representation of
  13. chess game data using ASCII text files.  PGN is structured to allow easy
  14. reading and writing by human users and easy parsing and generation by computer
  15. programs.  The intent of the definition and propagation of PGN is to facilitate
  16. the sharing of public domain chess game data among chessplayers (both organic
  17. and otherwise), publishers, and computer chess researchers throughout the
  18. world.
  19.  
  20. PGN is not intended to be a general purpose format that is suitable for every
  21. possible use; no format could fill all conceivable requirements.  Instead, PGN
  22. is proposed as a universal portable format for data interchange.  The idea is
  23. to allow the construction of a family of chess applications can be implemented
  24. such that they can read and write chess game data using PGN for import and
  25. export among themselves.
  26.  
  27.  
  28. 2: Design philosophy
  29.  
  30. Computer usage among chessplayers has become quite common in recent years and a
  31. number of programs, commercial and public domain, are used to access, generate,
  32. and propagate chess game data.  Some of these programs are rather impressive;
  33. most are now well behaved in that they correctly follow the Laws of Chess and
  34. handle users' data with reasonable care.  Unfortunately, most programs have
  35. serious problems with several aspects of the external representation of chess
  36. game data.  Sometimes these problems become more visible when a user attempts
  37. to move significant quantities of data from one program to another; if there
  38. has been no real effort to ensure portability of data, then the chances for a
  39. successful transfer are small at best.
  40.  
  41. The reasons for format incompatibility are easy to understand.  In fact, most
  42. of them are correlated with the same problems that have already been seen with
  43. commercial software offerings for other domains such as word processing,
  44. spreadsheets, fonts, and graphics.  Sometimes a manufacturer deliberately
  45. designs a data format using encryption or some other secret, proprietary
  46. technique to "lock in" a customer.  Sometimes a designer may produce a format
  47. that can be deciphered without too much difficulty, but at the same time
  48. publicly discourage third party software by claiming trade secret protection.
  49. Another software producer may develop a non-proprietary system, but it may work
  50. well only within the scope of a single program or application because it is not
  51. easily expandable.  Finally, some other software may work very well for many
  52. purposes, but it uses symbols and language not easily understood by people or
  53. computers available to those outside the country of development.
  54.  
  55. Therefore, a specification for a portable game notation must observe the
  56. lessons of history and be able to handle probable needs of the future.  The
  57. design criteria for PGN were selected to meet these needs.  These criteria
  58. include:
  59.  
  60. 1) The details of the system must be publicly available and free of unnecessary
  61. complexity.  Ideally, if the documentation is not available for some reason, a
  62. typical chess software developer or user should be able to understand the data
  63. without the need for third party assistance.
  64.  
  65. 2) The details of the system must be non-proprietary so that users and software
  66. developers are unrestricted by concerns about infringing on intellectual
  67. property rights.  The idea is to let chess programmers compete in a free market
  68. where customers may choose software based on their real needs and not
  69. artificial needs created by a secret data format.
  70.  
  71. 3) The system must work for a variety of programs.  The format should be such
  72. that it can be used by chess database programs, chess publishing programs,
  73. chess server programs, and chessplaying programs without being unnecessarily
  74. specific to any particular application class.
  75.  
  76. 4) The system must be easily expandable and scalable.  The expansion ability
  77. must include handling data items that may not exist currently but could be
  78. expected to emerge in the future.  Examples: new opening classifications and
  79. new country names.  The system should be scalable in that it must not have any
  80. arbitrary restrictions concerning the quantity of stored data.  Also, planned
  81. modes of expansion should either preserve earlier database or at least allow
  82. for their automatic conversion.
  83.  
  84. 5) The system must be international.  Chess software users are found in many
  85. countries and the system should be free of difficulties caused by conventions
  86. local to a given region.
  87.  
  88. 6) Finally, the system should handle the same kinds and amounts of data that
  89. are already handled by existing chess software and by print media.
  90.  
  91.  
  92. 3: Formats: Import and export
  93.  
  94. There are two formats in the PGN specification.  These are the "import" format
  95. and the "export" format.  There are two different ways of formatting the same
  96. PGN data according to its source.  The details of the two formats are described
  97. throughout the following sections of this document.
  98.  
  99.  
  100. 3.1: Import format allows for manually prepared data
  101.  
  102. The import format is rather flexible and is used to describe data that may have
  103. been prepared by hand, much like a source file for a high level programming
  104. language.  A program that can read PGN data should be able to handle the
  105. somewhat lax import format.
  106.  
  107.  
  108. 3.2: Export format used for program generated output
  109.  
  110. The export format is rather strict and is used to describe data that is usually
  111. prepared under program control, something like a pretty printed source program
  112. reformatted by a compiler.
  113.  
  114. For a given PGN data file, export format representations generated by different
  115. PGN programs on the same computing system should be exactly equivalent, byte
  116. for byte.
  117.  
  118. Export format should also be used for archival storage.  Here, "archival"
  119. storage is defined as storage that may be accessed by a variety of computing
  120. systems.  The only extra requirement for archival storage is that the newline
  121. character have a specific representation that is independent of its value for a
  122. particular computing system's text file usage.  The archival representation of
  123. a newline is the ASCII control character LF (line feed, decimal value 10).
  124.  
  125. Several parts of the export format deal with exact descriptions of line and
  126. field justification that are absent from the import format details.  The main
  127. reason for these restrictions on the export format are to allow the
  128. construction of simple data translation programs that can easily scan PGN data
  129. without having to have a full chess engine or other complex parsing routines.
  130. The idea is to encourage chess software authors to always allow for at least a
  131. limited PGN reading capability.  Even when a full chess engine parsing
  132. capability is available, it is likely to be at least two orders of magnitude
  133. slower than a simple text scanner.
  134.  
  135. A PGN game represented using export format is said to be in reduced export
  136. format if all of the following hold: 1) it has no commentary, 2) it has only
  137. the standard seven tag roster identification information (see below), 3) it has
  138. no recursive annotation variations (see below), and 4) it has no numeric
  139. annotation glyphs (see below).  Reduced export format is used for bulk storage
  140. of unannotated games.  It represents a minimum level of standard conformance
  141. for a PGN exporting application.
  142.  
  143.  
  144. 4: Lexicographical issues
  145.  
  146. PGN data is composed of characters; these form in turn form lexical tokens.
  147.  
  148.  
  149. 4.1: Character codes
  150.  
  151. PGN data is represented using only the ASCII character set with character codes
  152. restricted to those with decimal numeric values of less than 128.  Furthermore,
  153. only printable characters with codes from 32 to 127 are used along with the
  154. newline character and the horizontal and vertical tab characters.  The external
  155. representation of the newline character may differ among platforms; this is an
  156. acceptable variation as long as the details of the implementation are hidden
  157. from software implementors and users.
  158.  
  159.  
  160. 4.2: Tab characters
  161.  
  162. Tab characters, both horizontal and vertical, are not permitted in the export
  163. format.  This is because the treatment of tab characters is highly dependent
  164. upon the particular software in use on the host computing system.
  165.  
  166.  
  167. 4.3: Line lengths
  168.  
  169. PGN data are organized as simple text lines without any special bytes or
  170. controls for secondary record structure imposed by specific operating systems.
  171. Import format PGN text lines are limited to having a maximum of 255 characters
  172. per line including the newline character.  Lines with 80 or more printing
  173. characters are strongly discouraged because of the difficulties experienced by
  174. common text editors with long lines.  Export format text lines are limited to
  175. having fewer than 80 characters per line.  These limits are chosen to
  176. facilitate ease of implementation and ease of viewing.  Also, some systems
  177. require explicit text file line record length limits.  Sad, but true.
  178.  
  179.  
  180. 5: Commentary
  181.  
  182. Comment text may appear in PGN data.  There are two types of comments.  The
  183. first type is the "rest of line" comment; this comment type starts with a
  184. semicolon character and continues to the end of the line.  The second type
  185. starts with a left brace character and continues to the next right brace
  186. character.  Brace comments do not nest.  A semicolon appearing inside of a
  187. brace comment loses its special meaning and is ignored.  Braces appearing
  188. inside of a semicolon comments lose their special meaning and are ignored.
  189.  
  190. *** Export format representation of comments needs definition work.
  191.  
  192.  
  193. 6: Escape mechanism
  194.  
  195. There is a special escape mechanism for PGN data.  This mechanism is triggered
  196. by a percent sign character appearing in the first column of a line; the data
  197. on the rest of the line is ignored by publicly available PGN scanning software.
  198. This escape convention is intended for the private use of software developers
  199. and researchers to embed commands and data in PGN streams.
  200.  
  201.  
  202. 7: Tokens
  203.  
  204. PGN character data is organized as tokens.  A token is a contiguous sequence of
  205. characters that represents a basic semantic unit.  Tokens may be separated from
  206. adjacent tokens by whitespace characters.  Some tokens are self delimiting and
  207. do not require whitespace characters.
  208.  
  209. A string token is a sequence of zero or more characters that is delimited by a
  210. pair of quote characters (ASCII value 22).  An empty string is represented by
  211. two adjacent quotes.  (Note: an apostrophe is not a quote.)  A quote inside a
  212. string is represented by the backslash immediately followed by a quote.  A
  213. backslash inside a string is represented by two adjacent backslashes.  Strings
  214. are commonly used as tag pair values (see below).
  215.  
  216. An integer token is a sequence of one or more decimal digit characters.  It is
  217. a special case of the more general "symbol" token class described below.
  218. Integer tokens are used to help represent move number indications (see below).
  219.  
  220. A period character is a token by itself.  It is used for move number
  221. indications (see below).
  222.  
  223. An asterisk character is a token by itself.  It is used as one of the possible
  224. game termination markers (see below); it indicates an incomplete game or a game
  225. with an unknown or otherwise unavailable result.
  226.  
  227. The left and right bracket characters are tokens.  They are used to delimit tag
  228. pairs (see below).
  229.  
  230. The left and right parenthesis characters are tokens.  They are used to delimit
  231. Recursive Annotation Variations (see below).
  232.  
  233. A Numeric Annotation Glyph ("NAG", see below) is a token; it is composed of a
  234. dollar sign character immediately followed by one or more digit characters.
  235.  
  236. A symbol token starts with a letter or digit character and is immediately
  237. followed by a sequence of zero or more symbol continuation characters.  These
  238. continuation characters are letter characters, digit characters, the
  239. underscore, the plus sign, the octothorpe sign (i.e., pound sign; also known as
  240. the tic-tac-toe sign or the number sign), the equal sign, and the hyphen.
  241. Symbols are used for a variety of purposes.  All characters in a symbol are
  242. significant.
  243.  
  244.  
  245. 8: Parsing games
  246.  
  247. The basic element of a database composed of games data using the PGN format is
  248. the single PGN chess game.  A PGN database file is a sequential collection of
  249. zero or more PGN games.  An empty file is a valid, although somewhat
  250. uninformative, PGN database.
  251.  
  252. A PGN game is composed of two major sections.  The first is the tag pair
  253. section and the second is the movetext section.  The tag pair section provides
  254. information that identifies the game by defining the values associated with a
  255. set of standard parameters.  The movetext section gives the enumerated and
  256. possibly annotated moves of the game along with a concluding game termination
  257. marker.  The chess moves themselves are represented using SAN (Standard
  258. Algebraic Notation), also described later in this document.
  259.  
  260.  
  261. 8.1: Tag pair section
  262.  
  263. The tag pair section is composed of a series of zero or more tag pairs.
  264.  
  265. A tag pair is composed of four consecutive tokens: a left bracket token, a
  266. symbol token, a string token, and a right bracket token.  The symbol token is
  267. the tag name and the string token is the tag value associated with the tag
  268. name.  (There is a standard set of tag names and semantics described below.)
  269. The same tag name should not appear more than once in a tag pair section.
  270.  
  271. A further restriction on tag names is that they are composed exclusively of
  272. letters, digits, and the underscore character.  This is done to facilitate
  273. mapping of tag names into third party database programs.
  274.  
  275. For PGN import format, there may be zero or more whitespace characters between
  276. any adjacent pair of tokens in a tag pair.
  277.  
  278. For PGN export format, there are no whitespace characters between the left
  279. bracket and the tag name, there are no whitespace characters between the tag
  280. value and the right bracket, and there is a single space character between the
  281. tag name and the tag value.
  282.  
  283. Tag names, like all symbols, are case sensitive.  All tag names used for
  284. archival storage begin with an upper case letter.
  285.  
  286. PGN import format may have multiple tag pairs on the same line and may even
  287. have a tag pair spanning more than a single line.  Export format requires each
  288. tag pair to appear left justified on a line by itself; a single empty line
  289. follows the last tag pair.  Note that this requirement places a length limit
  290. for the entire tag pair because of the restriction of fewer than 80 characters
  291. per line.  Specifically, the sum of the character length of the tag name and
  292. the tag value should be less than 75.
  293.  
  294. Some tag values may be composed of a sequence of items.  For example, a
  295. consultation game may have more than one player for a given side.  When this
  296. occurs, the single character ":" (colon) appears between adjacent items.
  297.  
  298. The tag pair format is designed for expansion; initially only strings are
  299. allowed as tag pair values.  In future revisions, this will be expanded to a
  300. general list structure as needed.  This will also allow multi-line tag values
  301. at the same time.
  302.  
  303.  
  304. 8.1.1: Seven Tag Roster
  305.  
  306. There is a set of tags defined for mandatory use for archival storage of PGN
  307. data.  This is the STR (Seven Tag Roster).  The interpretation of these tags is
  308. fixed as is the order in which they appear.  Although other tag names and
  309. semantics are permitted and encouraged, the STR is the common ground that all
  310. programs should follow for public data interchange.
  311.  
  312. For import format, the order of tag pairs is not important.  For export format,
  313. the STR tags appear before any other tag pairs.  (The STR tag pair must also
  314. appear in order; this order is described below).  Also for export format, the
  315. additional tag pairs appear in ASCII order by tag name.
  316.  
  317. The seven tag names of the STR are (in order):
  318.  
  319. 1) Event (the name of the tournament or match event)
  320.  
  321. 2) Site (the location of the event)
  322.  
  323. 3) Date (the starting date of the game)
  324.  
  325. 4) Round (the playing round ordinal of the game)
  326.  
  327. 5) White (the player of the white pieces)
  328.  
  329. 6) Black (the player of the black pieces)
  330.  
  331. 7) Result (the result of the game)
  332.  
  333. A set of supplemental tag names is given in Appendix A of this document.
  334.  
  335. For PGN export format, a single blank line appears after the last of the tag
  336. pairs to conclude the tag pair section.  This helps simple scanning programs to
  337. quickly determine the end of the tag pair section and the beginning of the
  338. movetext section.
  339.  
  340.  
  341. 8.1.1.1: The Event tag
  342.  
  343. The Event tag value should be reasonably descriptive.  Abbreviations are to be
  344. avoided unless absolutely necessary to save space.  A consistent event naming
  345. should be used to help facilitate database scanning.  If the name of the event
  346. is unknown, a single question mark should appear as the tag value.
  347.  
  348. Examples:
  349.  
  350. [Event "FIDE World Championship"]
  351.  
  352. [Event "Moscow City Championship"]
  353.  
  354. [Event "ACM North American Computer Championship"]
  355.  
  356.  
  357. 8.1.1.2: The Site tag
  358.  
  359. The Site tag value should include city and region names along with a standard
  360. name for the country.  The use of the International Olympic Committee three
  361. letter names is suggested for those countries where such codes are available.
  362. If the site of the event is unknown, a single question mark should appear as
  363. the tag value.
  364.  
  365. Examples:
  366.  
  367. [Site "New York City, NY USA"]
  368.  
  369. [Site "St. Petersburg RUS"]
  370.  
  371. [Site "Riga LAT"]
  372.  
  373.  
  374. 8.1.1.3: The Date tag
  375.  
  376. The Date tag value gives the starting date for the game.  (Note: this is not
  377. necessarily the same as the starting date for the event.)  The Date tag value
  378. field always uses a standard ten character format: "YYYY.MM.DD".  The first
  379. four characters are digits that give the year, the next character is a period,
  380. the next two characters are digits that give the month, the next character is a
  381. period, and the final two characters are digits that give the day of the month.
  382. If the any of the digit fields are not known, then question marks are used in
  383. place of the digits.
  384.  
  385. Examples:
  386.  
  387. [Date "1992.08.31"]
  388.  
  389. [Date "1993.??.??"]
  390.  
  391. [Date "2001.01.01"]
  392.  
  393.  
  394. 8.1.1.4: The Round tag
  395.  
  396. The Round tag value gives the playing round for the game.  In a match
  397. competition, this value is the number of the game played.  In a simultaneous
  398. exhibition, this is the board number.  If the use of a round number is
  399. inappropriate, then the field should be a single hyphen character.  If the
  400. round is unknown, a single question mark should appear as the tag value.
  401.  
  402. Some organizers employ unusual round designations and have multipart playing
  403. rounds and sometimes even have conditional rounds.  In these cases, a multipart
  404. round identifier can be made from a sequence of integer round numbers separated
  405. by periods.  The leftmost integer represents the most significant round and
  406. succeeding integers represent round numbers in decending hierarchical order.
  407.  
  408. Examples:
  409.  
  410. [Round "1"]
  411.  
  412. [Round "3.1"]
  413.  
  414. [Round "4.1.2"]
  415.  
  416.  
  417. 8.1.1.5: The White tag
  418.  
  419. The White tag value is the name of the player or players of the white pieces.
  420. The names are given as they would appear in a telephone directory.  The family
  421. or last name appears first.  If a first name or first initial is available, it
  422. is separated from the family name by a comma and a space.  Finally, one or more
  423. middle initials may appear.  If the name is unknown, a single question mark
  424. should appear as the tag value.
  425.  
  426. The intent is to allow meaningful ASCII sorting of the tag value that is
  427. independent of regional name formation customs.  If more than one person is
  428. playing the white pieces, the names are listed in alphabetical order and are
  429. separated by the colon character between adjacent entries.  A player who is
  430. also a computer program should have appropriate version information listed
  431. after the name of the program.
  432.  
  433. The format used in the FIDE Rating Lists is appropriate for use for player name
  434. tags.
  435.  
  436. Examples:
  437.  
  438. [White "Tal, Mikhail N."]
  439.  
  440. [White "van der Wiel, Johan"]
  441.  
  442. [White "Acme Pawngrabber v.3.2"]
  443.  
  444.  
  445. 8.1.1.6: The Black tag
  446.  
  447. The Black tag value is the name of the player or players of the black pieces.
  448. The names are given here as they are for the White tag value.
  449.  
  450. Examples:
  451.  
  452. [Black "Lasker, Emmanuel"]
  453.  
  454. [Black "Smyslov, Vasily V."]
  455.  
  456. [Black "KingHunter IV:Smith, John Q.:Woodpusher 2000"]
  457.  
  458.  
  459. 8.1.1.7: The Result tag
  460.  
  461. The Result field value is the result of the game.  It is always exactly the
  462. same as the game termination marker that concludes the associated movetext.  It
  463. is always one of four possible values: "1-0" (White wins), "0-1" (Black wins),
  464. "1/2-1/2" (drawn game), and "*" (game still in progress, game abandoned, or
  465. result otherwise unknown).  Note that the digit zero is used in both of the
  466. first two cases; not the letter "O".
  467.  
  468. All possible examples:
  469.  
  470. [Result "0-1"]
  471.  
  472. [Result "1-0"]
  473.  
  474. [Result "1/2-1/2"]
  475.  
  476. [Result "*"]
  477.  
  478.  
  479. 8.2: Movetext section
  480.  
  481. The movetext section is composed of movetext elements.  These elements are:
  482. chess moves, move number indications, optional annotations, and a single
  483. concluding game termination marker.
  484.  
  485. Because illegal moves are not real chess moves, they are not permitted in PGN
  486. movetext.  They may appear in commentary, however.  One would hope that illegal
  487. moves are relatively rare in games worthy of recording.
  488.  
  489.  
  490. 8.2.1: Movetext line justification
  491.  
  492. In PGN import format, elements in the movetext do not require any specific line
  493. justification.
  494.  
  495. In PGN export format, elements in the movetext are placed left justified on
  496. successive text lines each of which has less than 80 printing characters.  As
  497. many elements as possible are placed on a line with the remainder appearing on
  498. successive lines.  A single space character appears between any two adjacent
  499. elements on the same line in the movetext.  As with the tag pair section, a
  500. single empty line follows the last line of data to conclude the movetext
  501. section.
  502.  
  503.  
  504. 8.2.2: Movetext move number indications
  505.  
  506. A move number indication is composed of one or more adjacent digits (an integer
  507. token) followed by zero or more periods.  The integer portion of the indication
  508. gives the move number of the immediately following white move (if present) and
  509. also the immediately following black move (if present).
  510.  
  511.  
  512. 8.2.2.1: Import format move number indications
  513.  
  514. PGN import format does not require move number indications.  It does not
  515. prohibit superfluous move number indications anywhere in the movetext as long
  516. as the move numbers are correct.
  517.  
  518. PGN import format move number indications may have zero or more period
  519. characters following the digit sequence that gives the move number; one or more
  520. whitespace characters may appear between the digit sequence and the period(s).
  521.  
  522.  
  523. 8.2.2.2: Export format move number indications
  524.  
  525. Export format requires a move number indication immediately prior to each white
  526. move and nowhere else.  Specifically, a move number indication does not appear
  527. immediately prior to a game termination marker.
  528.  
  529. Export format has exactly one period character immediately following the digit
  530. sequence; this forms a single movetext element.
  531.  
  532.  
  533. 8.2.3: Movetext SAN (Standard Algebraic Notation)
  534.  
  535. SAN (Standard Algebraic Notation) is a representation standard for chess moves
  536. using the ASCII Latin alphabet.
  537.  
  538. Examples of SAN recorded games are found throughout most modern chess
  539. publications.  SAN as presented in this document uses English language single
  540. character abbreviations for chess pieces, although this is easily changed in
  541. the source.  English is chosen over other languages because it appears to be
  542. the most widely recognized.
  543.  
  544. An alternative to SAN is FAN (Figurine Algebraic Notation).  FAN uses miniature
  545. piece icons instead of single letter piece abbreviations.  The two notations
  546. are otherwise identical.
  547.  
  548. Details about SAN construction are given in the FIDE Laws of Chess and are also
  549. described in the following sections of this document.
  550.  
  551.  
  552. 8.2.3.1: Square identification
  553.  
  554. SAN identifies each of the sixty four squares on the chessboard with a unique
  555. two character name.  The first character of a square identifier is the file of
  556. the square; a file is a column of eight squares designated by a single lower
  557. case letter from "a" (left most or queenside) up to and including "h" (right
  558. most or kingside).  The second character of a square identifier is the rank of
  559. the square; a rank is a row of eight squares designated by a single digit from
  560. "1" (bottom most [White's first rank]) up to and including "8" (top most
  561. [Black's first rank]).  The initial squares of some pieces are: white queen
  562. rook at a1, white king at e1, black queen knight pawn at b7, and black king
  563. rook at h8.
  564.  
  565.  
  566. 8.2.3.2: Piece identification
  567.  
  568. SAN identifies each piece by a single upper case letter.  The standard English
  569. values: pawn = "P", knight = "N", bishop = "B", rook = "R", queen = "Q", and
  570. king = "K".
  571.  
  572. The letter code for a pawn is not used for SAN moves in PGN output movetext.
  573. However, some PGN import software disambiguation code may allow for the
  574. appearence of pawn letter codes.  Also, there is the possibility of using pawn
  575. and other piece letter codes in tag pair and annotation constructs to be
  576. defined in the future.
  577.  
  578. It is admittedly a bit chauvinistic to select English piece letters over those
  579. from other languages.  There is a slight justification in that English is a de
  580. facto universal second language among most chessplayers and software users and
  581. authors.  It is probably the best that can be done for now.  Appendix I of this
  582. document gives alternative piece letters, but these should be used only for
  583. local presentation software and not for archival storage or for dynamic
  584. interchange among programs.
  585.  
  586.  
  587. 8.2.3.3: Basic SAN move construction
  588.  
  589. A basic SAN move is given by listing the moving piece letter (omitted for
  590. pawns) followed by the destination square.  Capture moves are denoted by the
  591. lower case letter "x" immediately prior to the destination square; pawn
  592. captures include the file letter of the originating square of the capturing
  593. pawn immediately prior to the "x" character.
  594.  
  595. SAN kingside castling is indicated by the sequence "O-O"; queenside castling is
  596. indicated by the sequence "O-O-O".  Note that the upper case letter "O" is
  597. used, not the digit zero.  The use of a zero character is not only incompatible
  598. with traditional text practices, but it can also confuse parsing software which
  599. also has to understand about move numbers and game termination markers.
  600.  
  601. En passant captures do not have any special notation; they are formed as if the
  602. captured pawn were on the capturing pawn's destination square.  Pawn promotions
  603. are denoted by the equal sign "=" immediately following the destination square
  604. with a promoted piece letter (indicating one of knight, bishop, rook, or queen)
  605. immediately following the equal sign.  As above, the piece letter is in upper
  606. case.
  607.  
  608. In the case of ambiguities (multiple pieces of the same type moving to the same
  609. square), the first appropriate disambiguating step of the three following steps
  610. is taken:  First, if the moving pieces can be distinguished by their
  611. originating files, the originating file letter of the moving piece is inserted
  612. immediately after the moving piece letter.  Second (when the first step fails),
  613. if the moving pieces can be distinguished by their originating ranks, the
  614. originating rank digit of the moving piece is inserted immediately after the
  615. moving piece letter.  Third (when both the first and the second steps fail),
  616. the two character square coordinate of the originating square of the moving
  617. piece is inserted immediately after the moving piece letter.  The result of the
  618. SAN actions described so for is called "the basic SAN move notation".
  619.  
  620.  
  621. 8.2.3.4: Check and checkmate indication characters
  622.  
  623. If the move is a checking move, the plus sign "+" is appended as a suffix to
  624. the basic SAN notation; if the move is a checkmating move, the octothorpe sign
  625. "#" is appended instead.  Neither the appearance nor the absence of either a
  626. check or checkmating indicator is used for disambiguation purposes.
  627.  
  628. There are no special markings used for double checks or discovered checks.
  629.  
  630.  
  631. 8.2.3.5: SAN move length
  632.  
  633. SAN moves can be as short as two characters (e.g., "d4"), or as long as seven
  634. characters (e.g., "Qa6xb7#").  The average SAN move length seen in realistic
  635. games is probably just fractionally longer than three characters.  If the SAN
  636. rules seem complicated, be assured that the earlier notation systems of LEN
  637. (Long English Notation) and EDN (English Descriptive Notation) are much more
  638. complex, and that LAN (Long Algebraic Notation, the predecessor of SAN) is
  639. unnecessarily bulky.
  640.  
  641.  
  642. 8.2.3.6: Import and export SAN
  643.  
  644. PGN export format always uses the above canonical SAN to represent moves in the
  645. movetext section of a PGN game.  Import format is somewhat more relaxed and it
  646. makes allowances for moves that do not conform exactly to the canonical format.
  647. However, the allowances may differ among different PGN reader software.  Only
  648. data appearing in export format is in all cases guaranteed to be importable
  649. into all PGN readers.
  650.  
  651. There are a number of suggested guidelines for use with implementing PGN reader
  652. software for permitting non-canonical SAN move representation.  The idea is to
  653. have a PGN reader apply various transformations to attempt to discover the move
  654. that is represented by non-canonical input.  Some suggested transformations
  655. include: letter case remapping, capture indicator insertion, check indicator
  656. insertion, and checkmate indicator insertion.
  657.  
  658.  
  659. 8.2.4: Movetext NAG (Numeric Annotation Glyph)
  660.  
  661. An NAG (Numeric Annotation Glyph) is a movetext element that is used to
  662. indicate a simple annotation in a language independent manner.  An NAG always
  663. annotates the immediately preceding move.
  664.  
  665. *** The NAG "$0" is defined to be the null annotation.  Additional NAGs are to
  666. be defined later.  Also, it may be useful to extend NAG usage to include
  667. operands other than or in addition to the immediately preceding move.
  668.  
  669.  
  670. 8.2.5: Movetext RAV (Recursive Annotation Variation)
  671.  
  672. An RAV (Recursive Annotation Variation) is a sequence of movetext containing
  673. zero or more moves enclosed in parentheses.  An RAV is used to represent an
  674. alternative variation.  The alternate move sequence given by an RAV is one that
  675. may be legally played by first unplaying the move that appears immediately
  676. prior to the RAV.  Because the RAV is a recursive construct, it may be nested.
  677.  
  678. *** The specification for import/export representation of RAV elements needs
  679. further development.
  680.  
  681.  
  682. Appendix A: Supplemental tag names
  683.  
  684. The following tag names and their associated semantics are recommended for use
  685. for information not contained in the Seven Tag Roster.
  686.  
  687. A.1: Player related information
  688.  
  689. WhiteTitle, BlackTitle: String values such as "FM", "IM", and "GM"; these tags
  690. are used only for the standard abbreviations for FIDE titles.
  691.  
  692. WhiteElo, BlackElo: Integer values; these are used for FIDE Elo ratings.
  693.  
  694. WhiteUSCF, BlackUSCF: Integer values; these are used for USCF (United States
  695. Chess Federation) ratings.  Similar tag names can be constructed for other
  696. rating agencies.
  697.  
  698.  
  699. A.2: Event related information
  700.  
  701. EventDate: A date value, similar to the Date tag field, that gives the starting
  702. date of the Event.
  703.  
  704. EventSponsor: A string value giving the name of the sponsor of the event.
  705.  
  706. Section: A string; this is used for the playing section of a tournament (e.g.,
  707. "Open" or "Reserve").
  708.  
  709. Stage: A string; this is used for the stage of a multistage event (e.g.,
  710. "Preliminary" or "Semifinal").
  711.  
  712. Board: An integer; this identifies the board number in a team event.
  713.  
  714.  
  715. A.3: Opening information
  716.  
  717. Opening: A string; this is used for the traditional opening name.  This will
  718. vary by locale.
  719.  
  720. Variation: A string; this is used to further refine the Opening tag.  This will
  721. vary by locale.
  722.  
  723. SubVariation: A string; this is used to further refine the Variation tag.  This
  724. will vary by locale.
  725.  
  726. ECO: String of the form "XDD/DD" where the "X" is a letter from "A" to "E" and
  727. the "D" positions are digits; this is used for an opening designation from the
  728. five volume _Encyclopedia of Chess Openings_.
  729.  
  730. NIC: A string; this is used for an opening designation from the _New in Chess_
  731. database.
  732.  
  733.  
  734. A.4: Miscellaneous
  735.  
  736. Annotator: A name or names in the format of the player name tags; this
  737. identifies the annotator of the game.
  738.  
  739. Time: A time-of-day value in the form "HH:MM:SS"; similar to the Date tag
  740. except that it denotes the local clock time (hours, minutes, and seconds) of
  741. the start of the game.  Note that colons, not periods, are used for internal
  742. separators for the Time value.
  743.  
  744.  
  745. Appendix B: Numeric Annotation Glyphs
  746.  
  747. *** TBD
  748.  
  749.  
  750. Appendix C: File names and directories
  751.  
  752. File names chosen for PGN data should be both informative and portable.  The
  753. directory names and arrangements should also be chosen for the same reasons and
  754. also for ease of navigation.
  755.  
  756. Some of suggested file and directory names may be difficult or impossible to
  757. represent on certain computing systems.  Use of appropriate conversion customs
  758. is encouraged.
  759.  
  760.  
  761. C.1: File name suffix for PGN data
  762.  
  763. The use of the file suffix ".pgn" is encouraged for ASCII text files containing
  764. PGN data.
  765.  
  766.  
  767. C.2: File name formation for PGN data for a specific player
  768.  
  769. PGN games for a specific player should have a file name consisting of the
  770. player's last name followed by the ".pgn" suffix.
  771.  
  772.  
  773. C.3: File name formation for PGN data for a specific event
  774.  
  775. PGN games for a specific event should have a file name consisting of the
  776. event's name followed by the ".pgn" suffix.
  777.  
  778.  
  779. C.4: File name formation for PGN data for chronologically ordered games
  780.  
  781. PGN data files used for chronologically ordered (oldest first) archives use
  782. date information as file name root strings.  A file containing all the PGN
  783. games for a given year would have an eight character name in the format
  784. "YYYY.pgn".  A file containing PGN data for a given month would have a ten
  785. character name in the format "YYYYMM.pgn".  Finally, a file for PGN games for a
  786. single day would have a twelve character name in the format "YYYYMMDD.pgn".
  787. Large files are split into smaller files as needed.
  788.  
  789. As game files are commonly arranged by chronological order, games with missing
  790. or incomplete Date tag pair data are to be avoided.  Any question mark
  791. characters in a Date tag value will be treated as zero digits for collation
  792. within a file and also for file naming.
  793.  
  794. Large quantities of PGN data arranged by chronological order should be
  795. organized into hierarchical directories.  A directory containing all PGN data
  796. for a given year would have a four character name in the format "YYYY";
  797. directories containing PGN files for a given month would have a six character
  798. name in the format "YYYYMM".
  799.  
  800.  
  801. C.5: A suggested directory tree
  802.  
  803. A suggested directory arrangement for ftp sites and CD-ROM distributions:
  804.  
  805. * PGN: master directory of the PGN subtree (e.g., pub/chess/PGN)
  806.  
  807. * PGN/ReadMe: brief description of the local directory contents
  808.  
  809. * PGN/Standard: the PGN standard (this document)
  810.  
  811. * PGN/News: news and status of the entire PGN subtree
  812.  
  813. * PGN/Tools: software utilities that access PGN data
  814.  
  815. * PGN/Players: directory of PGN files, each for a specific player
  816.  
  817. * PGN/Players/ReadMe: brief description of the local directory contents
  818.  
  819. * PGN/Players/News: news and status of the player collection
  820.  
  821. * PGN/Events: directory of PGN files, each for a specific event
  822.  
  823. * PGN/Events/ReadMe: brief description of the local directory contents
  824.  
  825. * PGN/Events/News: news and status of the event collection
  826.  
  827. * PGN/MGR: directory of the Master Games Repository subtree
  828.  
  829. * PGN/MGR/ReadMe: brief description of the local directory contents
  830.  
  831. * PGN/MGR/News: news and status of the entire PGN/MGR subtree
  832.  
  833. * PGN/MGR/YYYY: directory of games or subtrees for the year YYYY
  834.  
  835. * PGN/MGR/YYYY/ReadMe: description of local directory for year YYYY
  836.  
  837. * PGN/MGR/YYYY/News: news and status for year YYYY data
  838.  
  839.  
  840. Appendix D: PGN collating sequence
  841.  
  842. There is a standard sorting order for PGN games within a file.  This collation
  843. is based on eight keys; these are the seven tag values of the STF and also the
  844. movetext itself.
  845.  
  846. The first (most important, primary key) is the Date tag.  Earlier dated games
  847. appear prior to games played at a later date.  This field is sorted by
  848. ascending numeric value first with the year, then the month, and finally the
  849. day of the month.  Query characters used for unknown date digit values will be
  850. treated as zero digit characters for ordering comparison.
  851.  
  852. The second key is the Event tag.  This is sorted in ascending ASCII order.
  853.  
  854. The third key is the Site tag.  This is sorted in ascending ASCII order.
  855.  
  856. The fourth key is the Round tag.  This is sorted in ascending numeric order
  857. based on the value of the integer used to denote the playing round.  A query or
  858. hyphen used for the round is ordered before any integer value.  A query
  859. character is ordered before a hyphen character.
  860.  
  861. The fifth key is the White tag.  This is sorted in ascending ASCII order.
  862.  
  863. The sixth key is the Black tag.  This is sorted in ascending ASCII order.
  864.  
  865. The seventh key is the Result tag.  This is sorted in ascending ASCII order.
  866.  
  867. The eighth key is the movetext itself.  This is sorted in ascending ASCII order
  868. with the entire text including spaces and newline characters.
  869.  
  870.  
  871. Appendix E: PGN software
  872.  
  873. This appendix describes some PGN software that is currently available.  The
  874. entries are presented in rough chronological order of their initial
  875. availability.  Authors of PGN capable software are encouraged to contact the
  876. PGN standard coordinator (e-mail address listed near the start of this
  877. document) so that the information may be included here in this section.
  878.  
  879. Some PGN software is freeware and can be gotten from ftp sites and other
  880. sources.  Other PGN software is payware and appears as part of commercial
  881. chessplaying programs and chess database managers.  Those who are interested in
  882. the propagation of the PGN standard are encouraged to support manufacturers of
  883. chess software that use the standard.  If a particular vendor does not offer
  884. PGN compatibility, it is likely that a few letters to them along with a copy of
  885. this specification may help them decide to include PGN support in their next
  886. release.
  887.  
  888. The staff at the University of Oklahoma at Norman (USA) have graciously
  889. provided an ftp site (chess.uoknor.edu) for the storage of chess related data
  890. and programs.  Because file names change over time, those accessing the site
  891. are encouraged to first retrieve the file "pub/chess/ls-lR.gz" for a current
  892. listing.  A scan of this listing will also help locate versions of PGN programs
  893. for machine types and operating systems other than those listed below.
  894.  
  895.  
  896. E.1: The SAN Kit
  897.  
  898. The SAN Kit is an ANSI C source chess programming toolkit available for free
  899. from the ftp site chess.uoknor.edu in the directory pub/chess/Unix as the file
  900. "SAN.tar.gz" (a gzip tar archive).  This kit contains code for PGN import and
  901. export and can be used to "regularize" PGN data into reduced export format by
  902. use of its "tfgg" command.  Code from this kit is freely redistributable for
  903. anyone as long as future distribution is unhindered for everyone.  The SAN Kit
  904. is undergoing continuous development, although dates of future deliveries are
  905. quite difficult to predict.  Suggestions and comments should be directed to its
  906. author, Steven J. Edwards (sje@world.std.com).
  907.  
  908.  
  909. E.2: pgnRead
  910.  
  911. The program pgnRead runs under MS Windows 3.1 and provides an interactive
  912. graphical user interface for scanning PGN data files.  This program includes a
  913. colorful figurine chessboard display and scrolling controls for game and game
  914. text selection.  It is available from the chess.uoknor.edu ftp site in the
  915. pub/chess/DOS directory; several versions are available with names of the form
  916. "pgnrd**.exe"; the latest at this writing is "pgnrd121.exe".  Suggestions and
  917. comments should be directed to its author, Keith Fuller (keithfx@aol.com).
  918.  
  919.  
  920. E.3: mail2pgn/GIICS
  921.  
  922. The program mail2pgn produces a PGN version of chess game data generated by the
  923. ICS (Internet Chess Server).  It can be found at the chess.uoknor.edu ftp site
  924. in the pub/chess/DOS directory as the file "mail2pgn.zip"  A C language version
  925. is in the directory pub/chessUnix as the file "mail2pgn.c".  Suggestions and
  926. comments should be directed to its author, John Aronson
  927. (aronson@helios.ece.arizona.edu).  This code has been reportedly incorporated
  928. into the GIICS (Graphical Interface for the ICS); suggestions and comments
  929. should be directed to its author, Tony Acero (ace3@midway.uchicago.edu).
  930.  
  931.  
  932. E.4: XBoard
  933.  
  934. XBoard is a comprehensive chess utility running under the X Window system that
  935. provides a graphical user interface in a portable manner.  A new version now
  936. handles PGN data.  It is available from the chess.uoknor.edu ftp site in the
  937. pub/chess/X directory as the file "xboard-3.0.pl9.tar.gz".  Suggestions and
  938. comments should be directed to its author, Tim Mann (mann@src.dec.com).
  939.  
  940.  
  941. E.5: cupgn
  942.  
  943. The program "cupgn" converts game data stored in the ChessBase format into PGN.
  944. It is available from the chess.uoknor.edu ftp site in the
  945. pub/chess/Game-Databases/CBUFF directory as the file "cupgn.tar.gz".  Another
  946. version is in the directory pub/chess/DOS as the file "cupgn120.exe".
  947. Suggestions and comments should be directed to its author, Anjo Anjewierden
  948. (anjo@swi.psy.uva.nl).
  949.  
  950.  
  951. E.6: Rumors
  952.  
  953. There are unofficial reports that the current or future versions of Chess
  954. Assistant, BookUp8, HIARCS, and Zarkov will have some degree of PGN
  955. compatibility.
  956.  
  957.  
  958. Appendix F: PGN data archives
  959.  
  960. The primary PGN data archive repository is located at the ftp site
  961. chess.uoknor.edu as the directory "pub/chess/PGN".  It is organized according
  962. to the description given in section C.5 of this document.
  963.  
  964.  
  965. Appendix G: International Olympic Committee country codes
  966.  
  967. International Olympic Committee country codes are employed for Site nation
  968. information because of their traditional use with the reporting of
  969. international sporting events.  Due to changes in geography and linguistic
  970. custom, some of the following may be incorrect or outdated.  Corrections and
  971. extensions should be sent via e-mail to the PGN coordinator address listed near
  972. the start of this document.
  973.  
  974. AFG: Afghanistan
  975. ALB: Albania
  976. ALG: Algeria
  977. AND: Andorra
  978. ANG: Angola
  979. ANT: Antigua
  980. ARG: Argentina
  981. ARM: Armenia
  982. AUS: Australia
  983. AZB: Azerbaijan
  984. BAN: Bangladesh
  985. BAR: Bahrain
  986. BHM: Bahamas
  987. BEL: Belgium
  988. BER: Bermuda
  989. BIH: Bosnia and Herzegovina
  990. BLA: Belarus
  991. BLG: Bulgaria
  992. BLZ: Belize
  993. BOL: Bolivia
  994. BRB: Barbados
  995. BRS: Brazil
  996. BRU: Brunei
  997. BSW: Botswana
  998. CAN: Canada
  999. CHI: Chile
  1000. COL: Columbia
  1001. CRA: Costa Rica
  1002. CRO: Croatia
  1003. CSR: Czechoslovakia
  1004. CUB: Cuba
  1005. CYP: Cyprus
  1006. DEN: Denmark
  1007. DOM: Dominican Republic
  1008. ECU: Ecuador
  1009. EGY: Egypt
  1010. ENG: England
  1011. ESP: Spain
  1012. EST: Estonia
  1013. FAI: Faroe Islands
  1014. FIJ: Fiji
  1015. FIN: Finland
  1016. FRA: France
  1017. GAM: Gambia
  1018. GCI: Guernsey-Jersey
  1019. GEO: Georgia
  1020. GER: Germany
  1021. GHA: Ghana
  1022. GRC: Greece
  1023. GUA: Guatemala
  1024. GUY: Guyana
  1025. HAI: Haiti
  1026. HKG: Hong Kong
  1027. HON: Honduras
  1028. HUN: Hungary
  1029. IND: India
  1030. IRL: Ireland
  1031. IRN: Iran
  1032. IRQ: Iraq
  1033. ISD: Iceland
  1034. ISR: Israel
  1035. ITA: Italy
  1036. IVO: Ivory Coast
  1037. JAM: Jamaica
  1038. JAP: Japan
  1039. JRD: Jordan
  1040. JUG: Yugoslavia
  1041. KAZ: Kazakhstan
  1042. KEN: Kenya
  1043. KIR: Kyrgyzstan
  1044. KUW: Kuwait
  1045. LAT: Latvia
  1046. LEB: Lebanon
  1047. LIB: Libya
  1048. LIC: Liechtenstein
  1049. LTU: Lithuania
  1050. LUX: Luxembourg
  1051. MAL: Malaysia
  1052. MAU: Mauritania
  1053. MEX: Mexico
  1054. MLI: Mali
  1055. MLT: Malta
  1056. MNC: Monaco
  1057. MOL: Moldova
  1058. MON: Mongolia
  1059. MOZ: Mozambique
  1060. MRC: Morocco
  1061. MRT: Mauritius
  1062. MYN: Myanmar
  1063. NCG: Nicaragua
  1064. NET: The Internet
  1065. NIG: Nigeria
  1066. NLA: Netherlands Antilles
  1067. NLD: Netherlands
  1068. NOR: Norway
  1069. NZD: New Zealand
  1070. OST: Austria
  1071. PAK: Pakistan
  1072. PAL: Palestine
  1073. PAN: Panama
  1074. PAR: Paraguay
  1075. PER: Peru
  1076. PHI: Philippines
  1077. PNG: Papua New Guinea
  1078. POL: Poland
  1079. POR: Portugal
  1080. PRC: People's Republic of China
  1081. PRO: Puerto Rico
  1082. QTR: Qatar
  1083. RIN: Indonesia
  1084. ROM: Romania
  1085. RUS: Russia
  1086. SAF: South Africa
  1087. SAL: El Salvador
  1088. SCO: Scotland
  1089. SEN: Senagal
  1090. SEY: Seychelles
  1091. SIP: Singapore
  1092. SLV: Slovenia
  1093. SMA: San Marino
  1094. SRI: Sri Lanka
  1095. SUD: Sudan
  1096. SUI: Switzerland
  1097. SUR: Surinam
  1098. SVE: Sweden
  1099. SWE: Sweden
  1100. SWZ: Switzerland
  1101. SYR: Syria
  1102. TAI: Thailand
  1103. TMT: Turkmenistan
  1104. TRK: Turkey
  1105. TTO: Trinidad and Tobago
  1106. TUN: Tunisia
  1107. UAE: United Arab Emirates
  1108. UGA: Uganda
  1109. UKR: Ukraine
  1110. URU: Uruguay
  1111. USA: United States of America
  1112. UZB: Uzbekistan
  1113. VEN: Venezuela
  1114. VGB: British Virgin Islands
  1115. VIE: Vietnam
  1116. VUS: U.S. Virgin Islands
  1117. WLS: Wales
  1118. YEM: Yemen
  1119. YUG: Yugoslavia
  1120. ZAM: Zambia
  1121. ZIM: Zimbabwe
  1122. ZRE: Zaire
  1123.  
  1124.  
  1125. Appendix H: Additional chess data standards
  1126.  
  1127. While PGN is used for game storage, there are other data representation
  1128. standards for other chess related purposes.
  1129.  
  1130.  
  1131. H.1: FEN
  1132.  
  1133. FEN is "Forsyth-Edwards Notation"; it is a standard for describing chess
  1134. positions using the ASCII character set.
  1135.  
  1136.  
  1137. H.1.1: History
  1138.  
  1139. FEN is based on a 19th century standard for position recording designed by the
  1140. Scotsman John Forsyth, a newspaper journalist.  The standard has been slightly
  1141. extended for use with chess software by Steven Edwards with assistance from
  1142. commentators on the Internet.
  1143.  
  1144.  
  1145. H.1.2: Uses for a position notation
  1146.  
  1147. Having a standard position notation is particularly important for chess
  1148. programmers as it allows them to share position databases.  For example, there
  1149. exist standard position notation databases with many of the classical benchmark
  1150. tests for chessplaying programs, and by using a common position notation format
  1151. many hours of tedious data entry can be saved.  Additionally, a position
  1152. notation can be useful for page layout programs and for confirming position
  1153. status for e-mail competition.
  1154.  
  1155. Many interesting chess problem sets represented with FEN can be found at the
  1156. chess.uoknor.edu ftp site in the directory pub/chess/SAN_testsuites.
  1157.  
  1158.  
  1159. H.1.3: Data fields
  1160.  
  1161. FEN specifies the piece placement, the active color, the castling availability,
  1162. the en passant target square, the halfmove clock, and the fullmove number.
  1163. These can all fit on a single text line in an easily read format.  The length
  1164. of a FEN position description varies somewhat according to the position. In
  1165. some cases, the description could be eighty or more characters in length and so
  1166. may not fit conveniently on some displays.  However, these positions aren't too
  1167. common.
  1168.  
  1169. A FEN description has six fields.  Each field is composed only of nonblank
  1170. printing ASCII characters.  Adjacent fields are separated by a single ASCII
  1171. space character.
  1172.  
  1173.  
  1174. H.1.3.1: Piece placement data
  1175.  
  1176. The first field represents the placement of the pieces on the board.  The board
  1177. contents are specified starting with the eighth rank and ending with the first
  1178. rank.  For each rank, the squares are specified from file a to file h.  White
  1179. pieces are identified by uppercase SAN piece letters ("PNBRQK") and black
  1180. pieces are identified by lowercase SAN piece letters ("pnbrqk").  Empty squares
  1181. are represented by the digits one through eight; the digit used represents the
  1182. count of contiguous empty squares.  A solidus character "/" is used to separate
  1183. data of adjacent ranks.
  1184.  
  1185.  
  1186. H.1.3.2: Active color
  1187.  
  1188. The second field represents the active color.  A lower case "w" is used if
  1189. White is to move; a lower case "b" is used if Black is the active player.
  1190.  
  1191.  
  1192. H.1.3.3: Castling availability
  1193.  
  1194. The third field represents castling availability.  This indicates potential
  1195. future castling that may not be possible at the moment due to blocking pieces
  1196. or enemy attacks.  If there is no castling availability for either side, the
  1197. single character symbol "-" is used.  Otherwise, a combination of from one to
  1198. four characters are present.  If White has kingside castling availability, the
  1199. uppercase letter "K" appears.  If White has queenside castling availability,
  1200. the uppercase letter "Q" appears.  If Black has kingside castling availability,
  1201. the lowercase letter "k" appears.  If Black has queenside castling
  1202. availability, then the lowercase letter "q" appears.  Those letters which
  1203. appear will be ordered first uppercase before lowercase and second kingside
  1204. before queenside.  There is no whitespace between the letters.
  1205.  
  1206.  
  1207. H.1.3.4: En passant target square
  1208.  
  1209. The fourth field is the en passant target square.  If there is no en passant
  1210. target square then the single character symbol "-" appears.  If there is an en
  1211. passant target square then is represented by a lowercase file character
  1212. immediately followed by a rank digit.  Obviously, the rank digit will be "3"
  1213. following a white pawn double advance (Black is the active color) or else be
  1214. the digit "6" after a black pawn double advance (White being the active color).
  1215.  
  1216.  
  1217. H.1.3.5: Halfmove clock
  1218.  
  1219. The fifth field is a nonnegative integer representing the halfmove clock.  This
  1220. number is the count of halfmoves (or ply) since the last pawn advance or
  1221. capturing move.  This value is used for the fifty move draw rule.
  1222.  
  1223.  
  1224. H.1.3.6: Fullmove number
  1225.  
  1226. The sixth and last field is a positive integer that gives the fullmove number.
  1227. This will have the value "1" for the first move of a game for both White and
  1228. Black.  It increments by one immediately after each move by Black.
  1229.  
  1230.  
  1231. H.1.4: Examples
  1232.  
  1233. Here's the FEN for the starting position:
  1234.  
  1235. rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
  1236.  
  1237. And after the move 1. e4:
  1238.  
  1239. rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1
  1240.  
  1241. And then after 1. ... c5:
  1242.  
  1243. rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2
  1244.  
  1245. And then after 2. Nf3:
  1246.  
  1247. rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2
  1248.  
  1249. For two kings on their home squares and a white pawn on e2 (White to move) with
  1250. thirty eight full moves played with five halfmoves since the last pawn move or
  1251. capture:
  1252.  
  1253. 4k3/8/8/8/8/8/4P3/4K3 w - - 5 39
  1254.  
  1255.  
  1256. H.2 EPD
  1257.  
  1258. EPD is "Extended Position Notation"; it is a standard for describing chess
  1259. positions along with an extended set of structured attribute values using the
  1260. ASCII character set.  It is intended for computer use for data intechange among
  1261. chessplaying programs.  It is also intended for the representation of portable
  1262. opening library repositories.  A specification for EPD is currently under
  1263. development.
  1264.  
  1265.  
  1266. Appendix I: Alternative chesspiece identifier letters
  1267.  
  1268. English language piece names are used to define the letter set for identifying
  1269. chesspieces in PGN movetext.  However, authors of software that is used only
  1270. for local presentation or scanning of chess move data may find it convenient to
  1271. use piece letter codes common in their locales.  This is not a problem as long
  1272. as PGN data that resides in archival storage or that is exchanged among
  1273. programs still uses the standard English piece letter codes: "PNBRQK".
  1274.  
  1275. For the above authors only, a list of alternative piece letter codes are
  1276. provided:
  1277.  
  1278. Language     Piece letters (pawn knight bishop rook queen king)
  1279. ----------   --------------------------------------------------
  1280. Czech        P J S V D K
  1281. Danish       B S L T D K
  1282. Dutch        O P L T D K
  1283. English      P N B R Q K
  1284. Estonian     P R O V L K
  1285. Finnish      P R L T D K
  1286. French       P C F T D R
  1287. German       B S L T R K
  1288. Hungarian    G H F B V K
  1289. Italian      P C A T D R
  1290. Norwegian    B S L T D K
  1291. Polish       P S G W H K
  1292. Portuguese   P C B T D R
  1293. Romanian     P C N T D R
  1294. Spanish      P C A T D R
  1295. Swedish      B S L T D K
  1296.  
  1297.  
  1298. PGN: EOF
  1299.